import React, {Component} from "react";
import { ConfigProvider } from "antd"
import { getStorage } from "@/utils/utils"
import { formatLocaleDocTitle, formatMsgByCn, myFormatMessage } from '@/utils/localeUtils';
import logo from "@/assets/yay.jpg"
import styles from "./UserLayout.less"

export default class UserLayout extends Component {

  render() {
    const {
      children,
      location: { pathname },
      breadcrumbNameMap,
    } = this.props;

    // 标识是不是在 “iframe"里面
    let isIframe = 'LOGIN' === getStorage('IFRAME_APP');

    const childBox = (
      <ConfigProvider>
        <div className={styles.childrenContainer} style={isIframe ? { margin: 0, width: '100%' } : {}}>
          {children}
        </div>
      </ConfigProvider>
    );

    if (isIframe) { // 如果是在 iframe 里，则只显示登录框
      return childBox;
    }
    return (
      <>
        <div className={styles.container}>
          <div className={styles.banner} style={{ position: 'relative' }}>
            <div className={styles.container_inner}>
              <a href={'https://ant.design/index-cn'} className={styles.logo}>
                <img src={logo}/>
                <div className={styles.logo_content}> Antd Design</div>
              </a>
              {/*<SelectLang {...this.props} className={styles.backIndex}/>*/}
              <a className={styles.backIndex} href={'https://ant.design/index-cn'}>{formatMsgByCn('返回首页')}</a>
              {/*<div className={styles.banner_content}>*/}
              {/*  <div className={styles.banner_content_title}>{myFormatMessage('login.field.title')}</div>*/}
              {/*  <div className={styles.banner_content_content}>{myFormatMessage('login.field.content')}</div>*/}
              {/*</div>*/}
            </div>
          </div>
          <div className={styles.container_inner} style={{ maxWidth: '100%' }}>

            <div className={styles.content}>
              {
                childBox
              }
            </div>

            {/*<GlobalFooter copyright={copyright}/>*/}
          </div>

        </div>
      </>
    )
  }
}
